package cn.watson.basic.utils;

import com.sun.org.apache.xpath.internal.operations.Bool;
import lombok.Data;

/**
* @Title: 返回操作是否成功
* @Description: describe
* @Author: ZhangRui
* @Version: 1.0
* @Date:  2022/6/25 14:31
* @Parameters: 
* @Return 
*/
@Data
public class AjaxResult {

    // 返回操作成功
    public Boolean success = true;
    // 提示语句
    public String message = "操作成功！！！";

    private Object resultObj;

    /**
    * @Title: me
    * @Description: 提供一个实列化对象的方法，不管是否成功，都会创建
    * @Author: ZhangRui
    * @Version: 1.0
    * @Date:  2022/6/24 11:04  
    * @Parameters: []
    * @Return cn.watson.basic.utils.AjaxResult
    */
    public static AjaxResult me(){
        return new AjaxResult();
    }

    /**
    * @Title: setsuccess
    * @Description: 提供set方法，为链式编程调用
    * @Author: ZhangRui
    * @Version: 1.0
    * @Date:  2022/6/24 11:06
    * @Parameters: [success]
    * @Return cn.watson.basic.utils.AjaxResult
    */
    public AjaxResult setsuccess(Boolean success){
        this.success = success;
        return this;
    }

    /**
    * @Title: setMsg
    * @Description: 提供set方法，为链式编程调用
    * @Author: ZhangRui
    * @Version: 1.0
    * @Date:  2022/6/24 11:08
    * @Parameters: [msg]
    * @Return cn.watson.basic.utils.AjaxResult
    */
    public AjaxResult setMessage(String message){
        this.message = message;
        return this;
    }

    /**
    * @Title: setResultObj
    * @Description: 提供set方法
    * @Author: ZhangRui
    * @Version: 1.0
    * @Date:  2022/7/1 19:31
    * @Parameters: [resultObj]
    * @Return cn.watson.basic.utils.AjaxResult
    */
    public AjaxResult setResultObj(Object resultObj){
        this.resultObj = resultObj;
        return this;
    }


}
